﻿#ifndef INSTRUCTIONDATAREADERSTARTCOLLECTION_H
#define INSTRUCTIONDATAREADERSTARTCOLLECTION_H

#include "ScriptInstruction.h"

class InstructionDataReaderStartCollection :public ScriptInstruction
{
  Q_OBJECT
private:
  ScriptRunner* scriptRunner = Q_NULLPTR;
  MEMSDataHandler* mEMSDataHandler = Q_NULLPTR;

public:
  InstructionDataReaderStartCollection()
  {
    scriptRunner = ScriptInstruction::getScriptRunner();
    mEMSDataHandler = ScriptInstruction::getMEMSDataHandler();
    instructionFlag = Instruction_DataReader_StartCollection;
  }
  ~InstructionDataReaderStartCollection()
  {}
public:
  void run()override
  {
    mEMSDataHandler->slot_startDataCollection();
    StateChecker<bool, MEMSDataHandler>::next_ifConditionReached(&MEMSDataHandler::getIsListen, mEMSDataHandler, true, scriptRunner->getTime_connectTimeOut(), scriptRunner);
  }

  QVector<float> getDataForSaving()override
  {
    QVector<float> savingData;
    savingData.append(instructionFlag);
    return savingData;
  }
};
#endif
